unit MotherMdl;

interface
uses Classes, forms, SysUtils, patterns;

type
  TModelMother = class(TObservable)
  public
    constructor Create;
    destructor Destroy; override;
    procedure response(cmd: string; const args: TCommand = nil; sargs: string = '');
  end;


implementation
uses commandlist, indexDef;

procedure TModelMother.response(cmd: string; const args: TCommand = nil; sargs: string = '');
var
  p: PResponseInfo;
begin
  //you can add very complex logic code here
  new(p);
  p.CMD := cmd;

  if cmd = CMD_NODE_SELECT then
  begin
    p.response := 'I was selected!';
  end
  else if cmd = CMD_DAD_PLAYGAME then
  begin
    p.Response := 'Sorry!';
    p.ActualMean := 'Oh, come on,be a mature man,stop playing the stupid game!';
  end
  else if cmd = CMD_DAD_PLAYGAME then
  begin
    p.Response := 'Sorry!';
    p.ActualMean := 'Oh, come on,be a mature man,stop playing the stupid game!';
  end
  else if (cmd = CMD_BABY_CHOCOLATE) then
  begin
    p.Response := 'Sorry,honey.No more today.';
    p.ActualMean := '';
  end
  else if (cmd = CMD_BABY_CARTOON) then
  begin
    p.Response := 'No,honey,it''s too late,go to sleep.';
    p.ActualMean := '';
  end;

  //release p when command released
  self.Notify(TCommand.create(cmd, p));
end;

constructor TModelMother.Create;
begin
end;

destructor TModelMother.Destroy;
begin
  inherited;
end;


end.

